package com.flurry.sdk;

import com.flurry.sdk.iq;
import java.io.DataInputStream;
import java.io.DataOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;

public class ip extends kw {
    private static final String t = ip.class.getName();
    public ArrayList<iq> a;
    /* access modifiers changed from: package-private */
    public final long b;
    /* access modifiers changed from: package-private */
    public final int c;
    /* access modifiers changed from: package-private */
    public final int d;
    /* access modifiers changed from: package-private */
    public final iw e;
    /* access modifiers changed from: package-private */
    public final Map<String, String> f;
    /* access modifiers changed from: package-private */
    public long g;
    /* access modifiers changed from: package-private */
    public int h;
    /* access modifiers changed from: package-private */
    public int i;
    /* access modifiers changed from: package-private */
    public String j;
    /* access modifiers changed from: package-private */
    public String k;
    /* access modifiers changed from: package-private */
    public boolean l;
    public it m;
    private final int u = 1000;
    private final int v = 30000;

    public ip(String str, long j2, String str2, long j3, int i2, int i3, iw iwVar, Map<String, String> map, int i4, int i5, String str3) {
        a(str2);
        this.n = j3;
        a_();
        this.k = str;
        this.b = j2;
        this.s = i2;
        this.c = i2;
        this.d = i3;
        this.e = iwVar;
        this.f = map;
        this.h = i4;
        this.i = i5;
        this.j = str3;
        this.g = 30000;
        this.a = new ArrayList<>();
    }

    public final void a_() {
        super.a_();
        if (this.p != 1) {
            this.g *= 3;
        }
    }

    public final synchronized void c() {
        this.m.c();
    }

    public final void d() {
        Iterator<iq> it = this.a.iterator();
        while (it.hasNext()) {
            it.next().l = this;
        }
    }

    public static class a implements lg<ip> {
        lf<iq> a = new lf<>(new iq.a());

        public final /* synthetic */ void a(OutputStream outputStream, Object obj) throws IOException {
            ip ipVar = (ip) obj;
            if (outputStream != null && ipVar != null) {
                AnonymousClass1 r1 = new DataOutputStream(outputStream) {
                    public final void close() {
                    }
                };
                if (ipVar.k != null) {
                    r1.writeUTF(ipVar.k);
                } else {
                    r1.writeUTF("");
                }
                if (ipVar.r != null) {
                    r1.writeUTF(ipVar.r);
                } else {
                    r1.writeUTF("");
                }
                r1.writeLong(ipVar.n);
                r1.writeInt(ipVar.p);
                r1.writeLong(ipVar.b);
                r1.writeInt(ipVar.c);
                r1.writeInt(ipVar.d);
                r1.writeInt(ipVar.e.e);
                Map f = ipVar.f;
                if (f != null) {
                    r1.writeInt(ipVar.f.size());
                    for (String str : ipVar.f.keySet()) {
                        r1.writeUTF(str);
                        r1.writeUTF((String) f.get(str));
                    }
                } else {
                    r1.writeInt(0);
                }
                r1.writeLong(ipVar.g);
                r1.writeInt(ipVar.h);
                r1.writeInt(ipVar.i);
                if (ipVar.j != null) {
                    r1.writeUTF(ipVar.j);
                } else {
                    r1.writeUTF("");
                }
                r1.writeBoolean(ipVar.l);
                r1.flush();
                this.a.a(outputStream, ipVar.a);
            }
        }

        public final /* synthetic */ Object a(InputStream inputStream) throws IOException {
            if (inputStream == null) {
                return null;
            }
            AnonymousClass2 r0 = new DataInputStream(inputStream) {
                public final void close() {
                }
            };
            String readUTF = r0.readUTF();
            if (readUTF.equals("")) {
                readUTF = null;
            }
            String readUTF2 = r0.readUTF();
            long readLong = r0.readLong();
            int readInt = r0.readInt();
            long readLong2 = r0.readLong();
            int readInt2 = r0.readInt();
            int readInt3 = r0.readInt();
            iw a2 = iw.a(r0.readInt());
            HashMap hashMap = null;
            int readInt4 = r0.readInt();
            if (readInt4 != 0) {
                hashMap = new HashMap();
                for (int i = 0; i < readInt4; i++) {
                    hashMap.put(r0.readUTF(), r0.readUTF());
                }
            }
            long readLong3 = r0.readLong();
            int readInt5 = r0.readInt();
            int readInt6 = r0.readInt();
            String readUTF3 = r0.readUTF();
            if (readUTF3.equals("")) {
                readUTF3 = null;
            }
            boolean readBoolean = r0.readBoolean();
            ip ipVar = new ip(readUTF, readLong2, readUTF2, readLong, readInt2, readInt3, a2, hashMap, readInt5, readInt6, readUTF3);
            long unused = ipVar.g = readLong3;
            boolean unused2 = ipVar.l = readBoolean;
            ipVar.p = readInt;
            ipVar.a = (ArrayList) this.a.a(inputStream);
            ipVar.d();
            return ipVar;
        }
    }
}
